home *** CD-ROM | disk | FTP | other *** search
- global gOutilActif, gcouleurActive, gFormeOutil, spr_Buffer, spr_Toile, spr_loupe, gRemplirZone, firstbackup, gIDXformat
-
- on beginSprite me
- firstbackup = 1
- sprite(47).member = member("format-" & gIDXformat)
- spr_Toile = me.spriteNum
- end
-
- on mouseDown me
- if gOutilActif = "outil" then
- doBackUp()
- if gFormeOutil = "pot" then
- rectPreview = sendSprite(spr_loupe, #locrect)
- rapport = float(rectPreview.width) / float(sprite(me.spriteNum).member.width)
- a = rectPreview[1] + ((the mouseH - sprite(me.spriteNum).left) * rapport)
- aprime = string(a)
- a = aprime.char[1..offset(".", aprime)]
- a = value(a)
- b = rectPreview[2] + ((the mouseV - sprite(me.spriteNum).top) * rapport)
- bprime = string(b)
- b = bprime.char[1..offset(".", bprime)]
- b = value(b)
- member("pictSource").image.floodFill(point(a, b), gcouleurActive)
- sendSprite(spr_loupe, #bouge)
- sendSprite(spr_loupe, #repaint)
- else
- oldPoint = 0
- repeat while the mouseDown
- tailleOutil = member(gFormeOutil).rect
- rectPreview = sendSprite(spr_loupe, #locrect)
- rapport = float(rectPreview.width) / float(sprite(me.spriteNum).member.width)
- a = rectPreview[1] + ((the mouseH - sprite(me.spriteNum).left) * rapport) - (tailleOutil.width / 2)
- aprime = string(a)
- a = aprime.char[1..offset(".", aprime)]
- a = value(a)
- b = rectPreview[2] + ((the mouseV - sprite(me.spriteNum).top) * rapport) - (tailleOutil.height / 2)
- bprime = string(b)
- b = bprime.char[1..offset(".", bprime)]
- b = value(b)
- c = a + tailleOutil.width
- d = b + tailleOutil.height
- recep = rect(a, b, c, d)
- if gFormeOutil = "forme_gomme" then
- recep = recep + rect(6, 7, 6, 7)
- end if
- repeat with i = 1 to 4
- recep[i] = integer(recep[i])
- end repeat
- member("pictSource").image.copyPixels(member(gFormeOutil).image, recep, member(gFormeOutil).rect, [#ink: 36, #color: gcouleurActive])
- if gFormeOutil = "forme_crayon" then
- if oldPoint <> 0 then
- coordline = rect(oldPoint.left, oldPoint.top, recep.right, recep.bottom)
- member("pictSource").image.draw(coordline, [#shapeType: #line, #lineSize: 1, #color: gcouleurActive])
- end if
- oldPoint = recep
- end if
- sendSprite(spr_loupe, #bouge)
- sendSprite(spr_loupe, #repaint)
- updateStage()
- end repeat
- end if
- else
- if gOutilActif = "zone" then
- doBackUp()
- if gFormeOutil = "line" then
- angle = "NO"
- sprite(spr_Buffer).member = member(gFormeOutil & "_" & angle)
- else
- sprite(spr_Buffer).member = member(gFormeOutil)
- end if
- a = the mouseH
- b = the mouseV
- repeat while the mouseDown
- if gFormeOutil = "line" then
- if the mouseH < a then
- if the mouseV < b then
- angle = "SO"
- else
- angle = "NO"
- end if
- else
- if the mouseV < b then
- angle = "SE"
- else
- angle = "NE"
- end if
- end if
- sprite(spr_Buffer).member = member(gFormeOutil & "_" & angle)
- updateStage()
- end if
- c = max(min(the mouseH, sprite(me.spriteNum).right), sprite(me.spriteNum).left)
- d = max(min(the mouseV, sprite(me.spriteNum).bottom), sprite(me.spriteNum).top)
- sprite(spr_Buffer).rect = rect(a, b, c, d)
- updateStage()
- end repeat
- sprite(spr_Buffer).loc = point(-1000, -1000)
- rectPreview = sendSprite(spr_loupe, #locrect)
- rapport = float(rectPreview.width) / float(sprite(me.spriteNum).member.width)
- a = rectPreview[1] + ((a - sprite(me.spriteNum).left) * rapport)
- b = rectPreview[2] + ((b - sprite(me.spriteNum).top) * rapport)
- c = rectPreview[1] + ((c - sprite(me.spriteNum).left) * rapport)
- d = rectPreview[2] + ((d - sprite(me.spriteNum).top) * rapport)
- recep = rect(a, b, c, d)
- if gFormeOutil <> "line" then
- recep = ordonne_rect(recep)
- end if
- repeat with i = 1 to 4
- recep[i] = integer(recep[i])
- end repeat
- if gFormeOutil = "resize" then
- img = image(member("pictSource").width, member("pictSource").height, 32)
- img.copyPixels(member("pictSource").image, member("pictSource").rect, recep)
- member("pictSource").image = img
- else
- if gRemplirZone then
- member("pictSource").image.fill(recep, [#shapeType: symbol(gFormeOutil), #lineSize: 0, #color: gcouleurActive])
- else
- case gFormeOutil of
- "rect":
- member("pictSource").image.draw(rect(recep.left, recep.top, recep.right, recep.top), [#shapeType: #line, #lineSize: 1, #color: gcouleurActive])
- member("pictSource").image.draw(rect(recep.right, recep.top, recep.right, recep.bottom), [#shapeType: #line, #lineSize: 1, #color: gcouleurActive])
- member("pictSource").image.draw(rect(recep.left, recep.bottom, recep.right + 1, recep.bottom), [#shapeType: #line, #lineSize: 1, #color: gcouleurActive])
- member("pictSource").image.draw(rect(recep.left, recep.top, recep.left, recep.bottom), [#shapeType: #line, #lineSize: 1, #color: gcouleurActive])
- otherwise:
- member("pictSource").image.draw(recep, [#shapeType: symbol(gFormeOutil), #lineSize: 1, #color: gcouleurActive])
- end case
- end if
- end if
- sendSprite(spr_loupe, #bouge)
- sendSprite(spr_loupe, #repaint)
- end if
- end if
- end
-
- on mouseUp me
- validReglage()
- pass()
- end
-